package com.dmcliver.timetracker.session;

import com.dmcliver.timetracker.entity.*;
import java.math.BigDecimal;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("feedbackHome")
public class FeedbackHome extends EntityHome<Feedback> {

	@In(create = true)
	JobHome jobHome;
	@In(create = true)
	TimeentryHome timeentryHome;

	public void setFeedbackFeedbackid(BigDecimal id) {
		setId(id);
	}

	public BigDecimal getFeedbackFeedbackid() {
		return (BigDecimal) getId();
	}

	@Override
	protected Feedback createInstance() {
		Feedback feedback = new Feedback();
		return feedback;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
		Job job = jobHome.getDefinedInstance();
		if (job != null) {
			getInstance().setJob(job);
		}
		Timeentry timeentry = timeentryHome.getDefinedInstance();
		if (timeentry != null) {
			getInstance().setTimeentry(timeentry);
		}
	}

	public boolean isWired() {
		return true;
	}

	public Feedback getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

}
